/**
 * @see https://umijs.org/zh-CN/plugins/plugin-access
 * */

//配合config/routes.ts使用
export default function access(
  initialState: {
  currentUser?: API.CurrentUser } | undefined) {
  const { currentUser } = initialState ?? {};
  return {
    //canAdmin: true,
    canAdmin: currentUser && currentUser.userRole === 1,
  };
}
